let nums  = [1,1,2];
var removeDuplicates = function(nums) {
    const len = nums.length;
    if(len === 0 ){return 0 }
    let i=0,j=0;
    while(j<=len){
        if( nums[i] === nums[j] )
            {
                j++;
            }else{
                i++;
                nums[i] = nums[j];
                j++;
            }
        
    }
    return i;
    };

removeDuplicates(nums);

